<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head></h:head>

<h:body onload="#{meteoBean.checkTomorrowWeather()}">
	<div id="logoHomePage" align="left">
		<a href="../homepage.xhtml"><img src="../grafica/MeteoCal_Logo.gif" width="150" height="50"/></a>
	</div>
	
	<div id="logout" align="right">
   		<h:form>
			<h:commandButton action="#{logoutBean.logout}" value="Logout" />
		</h:form>
	</div>
	
	<h:form>
		<p:panel header="Notification">
			<h:panelGrid columns="3" id="notificationGrid">
				
				<p:dataTable value="#{notificationBean.result}" var="result">  		        			
		        	<p:column headerText="New notification/s"> 
		       			#{result.text}   
		        	</p:column>
		        	<p:column headerText="delete">
		       			<p:commandButton value="Delete" action="#{notificationBean.delete(result.notificationid)}" />
		        	</p:column>
		   		</p:dataTable>
				
				<br></br>
				
				<p:dataTable value="#{invitationBean.result}" var="result">  		        			
		        	<p:column headerText="New invitation/s"> 
		       			#{result.title}   
		        	</p:column>
		        	<p:column headerText="acceptDecline">
		       			<p:commandButton value="Accept" action="#{invitationBean.accept(result.invitationid)}" />
		       			<p:commandButton value="Decline" action="#{invitationBean.decline(result.invitationid)}" />
		        	</p:column>
		   		</p:dataTable>
				
			</h:panelGrid>
			<p:commandButton value="Check notifications" update="notificationGrid" action="#{notificationBean.findByUser()}" />
			<p:commandButton value="Check invitations" update="notificationGrid" action="#{invitationBean.findByUser()}" />

		</p:panel>
		<div align="right"><h:link outcome="personal" value="Go to personal page" /></div>
	</h:form>  
	

	</h:body>
</html>
